﻿///////////////////////////////////////////////////////////////////////////////
//
//  This file is part of MathLib.NET.
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//  
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//  
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library;  If not, see 
//  <http://www.gnu.org/licenses/>.
//
///////////////////////////////////////////////////////////////////////////////

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Scripting;
using Microsoft.Scripting.Hosting;
using IronPython.Hosting;
using System.IO;

namespace MathLibTest
{
    class Program
    {
        static void Main(string[] args)
        {
            ScriptEngine engine = Python.CreateEngine();

            engine.Runtime.LoadAssembly(typeof(ILNumerics.BuiltInFunctions.ILMath).Assembly);
            engine.Runtime.LoadAssembly(typeof(MathLib.MLMath).Assembly);

            StreamReader sr = new StreamReader(System.Reflection.Assembly.GetEntryAssembly().GetManifestResourceStream("MathLibTest.Header.py"));
            string scriptCode = sr.ReadToEnd();
            sr = new StreamReader(System.Reflection.Assembly.GetEntryAssembly().GetManifestResourceStream("MathLibTest.TestScript.py"));
            scriptCode += sr.ReadToEnd();
            ScriptSource source = engine.CreateScriptSourceFromString(scriptCode, SourceCodeKind.File);
            CompiledCode compiledCode = source.Compile();

            compiledCode.Execute();
        }
    }
}
